{include file=header.html}

{include file=top.html}
<div id="content">
    {include file=goodsinfo.html}
    <div id="left">{include file=left.html}</div>

    <div id="right">
        <div id="module">
            <ul class="user_menu">
                <li>
                    <a class="normal" href="{url app=goods&id=$goods.goods_id}#module">
                        <span>{$lang.goods_detail}</span>
                    </a>
                </li>
                <li>
                    <a class="normal" href="{url app=goods&act=comments&id=$goods.goods_id}#module">
                        <span>{$lang.goods_comment}</span>
                    </a>
                </li>
                <li>
                    <a class="normal" href="{url app=goods&act=saleslog&id=$goods.goods_id}#module">
                        <span>{$lang.sales_log}</span>
                    </a>
                </li>
                <li>
                    <a class="normal" href="{url app=goods&act=qa&id=$goods.goods_id}#module">
                        <span>{$lang.qa}</span>
                    </a>
                </li>
            </ul>
        </div>
        <div class="clear"></div>

        <div class="module_currency">
            <div class="wrap">
                <div class="wrap_child">
                    <link href="{res file=cmprice/css/common.css}" rel="stylesheet" type="text/css">
                    <link href="{res file=cmprice/css/style.css}" rel="stylesheet" type="text/css">
                    <div class="parity" id="cmprice" >
                        <div class="parity-hd">
                             <!--<a href="#" title="" class="cur">默认</a>
                            <a href="#" title="">销量</a>
                            <a href="#" title="">价格</a>
                            <input type="checkbox">只显示自营</div> -->
                        <div class="parity-table">
                            <table border="1" width="100%">
                                <tbody>

                                    <tr v-for="d in datalist">
                                        <td class="parity-name">
                                        <span v-model="msg"></span>
                                           <!--  <img src="images/jd.gif" alt="" data-bd-imgshare-binded="1"> -->{{d.siteName}}</td>
                                        
                                        <td class="parity-title">
                                            {{ d.spname }}
                                        </td>
                                        <td class="parity-price">{{d.spprice|price}}</td>
                                        <td class="parity-info">与{{d.siteName}}相比{{d.spprice|cmprice}}元</td>
                                        <td class="parity-time">比价时间： <br>{$time|date:Y-m-d H:i}</td>
                                    </tr>
                                   
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.24/vue.min.js"></script>
<script type="text/javascript">
var doc=new Vue({
  el: '#cmprice',
  data:{
    keyword:'{$goods.cmprice_keyword}',
    datalist:null,
  },
  methods: {
    pull: function () {
       
        var url="/?app=goods&act=ajax_cmprice&keyword="+this.keyword;
        this.http(url);
    },
    render_data:function(data)
    {

        try{
            if(data.status)
            {
                this.datalist=data.data;
                
            }
            
        }catch(ex){
            console.log(data);
        }
    },
    http:function (url)
    {
        obj=this;
        $.getJSON(url,function(data){
            obj.render_data(data);
        });
    }
  }
})
$(document).ready(function() {
    doc.pull();
    Vue.filter('price',function(value) {
        return '¥'+value;
    });
    Vue.filter('cmprice',function(value) {
        var curr_price={$goods._specs.0.price|default:0};
        // curr_price=curr_price.split('¥');
        // curr_price=curr_price[1];
        var price=value*100-curr_price*100;
        if(price>0)
        {
            return '低'+''+Math.round(price)/100;
        }else{
            return '高'+''+Math.round(0-price)/100;
         }
    });
});


</script>
    <div class="clear"></div>
</div>
<style type="text/css">

.parity-info {
    width: 15%;
    color: #6B6B6B;
}
</style>
{include file=footer.html}